from django.urls import path, re_path, include
from django.conf.urls.static import static
from django.conf import settings
from django.views.static import serve
from . import views

urlpatterns = [
    path("", views.index, name="index"),
    re_path("dashboard.*", views.dashboard, name="dashboard"),
    path("favicon.ico", views.favicon, name="favicon"),
    path("register", views.register, name="register"),
    re_path("login.*", views.login, name="login"),
    re_path(".*logout.*", views.logout, name="logout"),
    re_path("userhome.*", views.userhome, name="userhome"),
    re_path("useradmin.*", views.useradmin, name="useradmin"),
    path('mdeditor/', include('mdeditor.urls')),
    path('editor/', views.editor, name="editor"),
]

# 关闭debug访问statics
if not settings.DEBUG:
    urlpatterns += [
        re_path("static/(?P<path>.*)$", serve, {"document_root": "statics"})
    ]
